package com.service.admin.product.controller;

import com.service.admin.product.controller.rep.ProductLockComboPageRep;
import com.service.admin.product.controller.req.ProductLockComboAddReq;
import com.service.admin.product.controller.req.ProductLockComboPageReq;
import com.service.admin.product.service.ProductLockComboService;
import com.service.core.rest.BaseController;
import com.service.core.rest.response.BaseResponse;
import com.service.core.rest.response.CommonPageRep;
import com.service.core.rest.response.PageResponse;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 存币业务 控制层
 *
 * @author 404notfound
 * @since 2021年05月12日10:11:34
 */
@RestController
@RequestMapping("/product-lock-combo")
@Api(value = "存币业务 API", tags = "存币业务 API", description = "存币业务 API")
public class ProductLockComboController extends BaseController {

    @Autowired
    private ProductLockComboService productLockComboService;

    @ApiOperation(value = "所有存币业务", notes = "所有存币业务", httpMethod = "POST")
    @ApiResponses({@ApiResponse(code = 200, message = "SUCCESS")})
    @ApiImplicitParams({@ApiImplicitParam(paramType = "ProductLockComboPageReq", name = "productLockComboPageReq",
            value = "comboName(产品名称)、comboType(产品类型)、comboStatus(产品状态)", required = true, dataType = "ProductLockComboPageReq")})
    @RequestMapping(value = "/page", method = RequestMethod.POST)
    public PageResponse<ProductLockComboPageRep> page(@RequestBody ProductLockComboPageReq productLockComboPageReq) {
        //查询所有所有存币业务
        CommonPageRep<ProductLockComboPageRep> list = productLockComboService.pageLockCombo(productLockComboPageReq);
        return successQueryPageResponse(list);
    }

    @ApiOperation(value = "添加存币业务", notes = "添加存币业务", httpMethod = "POST")
    @ApiResponses({@ApiResponse(code = 200, message = "SUCCESS")})
    @ApiImplicitParams({@ApiImplicitParam(paramType = "ProductLockComboAddReq", name = "productLockComboAddReq",
            value = "productLockComboAddReq",
            required = true, dataType = "ProductLockComboAddReq")})
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public BaseResponse add(@RequestBody ProductLockComboAddReq productLockComboAddReq) {
        //添加存币业务
        productLockComboService.add(productLockComboAddReq);
        return successSaveBaseResponse();
    }


    @ApiOperation(value = "删除存币业务", notes = "删除存币业务", httpMethod = "GET")
    @ApiResponses({@ApiResponse(code = 200, message = "SUCCESS")})
    @ApiImplicitParams({@ApiImplicitParam(paramType = "Integer", name = "id", value = "id", required = true, dataType = "Integer")})
    @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
    public BaseResponse delete(@PathVariable Integer id) {
        //删除存币业务
        productLockComboService.delete(id);
        return successDeleteBaseResponse();
    }

    @ApiOperation(value = "下架存币业务", notes = "下架存币业务", httpMethod = "GET")
    @ApiResponses({@ApiResponse(code = 200, message = "SUCCESS")})
    @ApiImplicitParams({@ApiImplicitParam(paramType = "Integer", name = "id", value = "id", required = true, dataType = "Integer")})
    @RequestMapping(value = "/soldOut/{id}", method = RequestMethod.GET)
    public BaseResponse soldOut(@PathVariable Integer id) {
        //删除存币业务
        productLockComboService.soldOut(id);
        return successDeleteBaseResponse();
    }

    @ApiOperation(value = "上架存币业务", notes = "上架存币业务", httpMethod = "GET")
    @ApiResponses({@ApiResponse(code = 200, message = "SUCCESS")})
    @ApiImplicitParams({@ApiImplicitParam(paramType = "Integer", name = "id", value = "id", required = true, dataType = "Integer")})
    @RequestMapping(value = "/soldUp/{id}", method = RequestMethod.GET)
    public BaseResponse soldUp(@PathVariable Integer id) {
        //删除存币业务
        productLockComboService.soldUp(id);
        return successDeleteBaseResponse();
    }


}
